package com.leetCode.easy;

/**
 * 一组数组的动态和
 */
public class SumNums {

    public static int[] runningSum(int[] nums){
        int[] newNums = new int[nums.length];
        for (int i = 0; i < nums.length; i++) {
            if (i == 0) {
                newNums[i] = nums[i];
            } else {
                newNums[i] = nums[i] + newNums[i - 1];
            }
        }
        return newNums;
    }
}
